package com.test.websample.service.impl;

import com.test.websample.mapper.UserMapper;
import com.test.websample.pojo.User;
import com.test.websample.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper mapper;

    @Override
    public User getUserById(Integer id) {
        return mapper.getUserById(id);
    }

    @Override
    public User getUserByName(String name) {
        return mapper.getUserByName(name);
    }

    @Override
    public void addUser(User user) {
        mapper.addUser(user.getName(), user.getAge(), user.isAlive(), user.getPassword());
    }
}
